package com.design.StateMode.simpleDemo;

/**
 * @Description: 红灯状态处理
 * @Author: LiHaiChao
 * @Date: 2022/1/13 13:57:16
 * @Version: 1.0
 */
public class RedState implements State{

    public static final String RED_LAMP = "red";

    private String lamp;

    public RedState(String lamp) {
        this.lamp = lamp;
    }

    @Override
    public void handler() {
        if(lamp.equals(RED_LAMP)){
            System.out.println("当前红灯 -> 停车!");
        }else{
            System.out.println("错误状态");
        }
    }
}
